package com.example.easeimpro.model.db;

import android.content.Context;
import android.util.Log;

import com.example.easeimpro.model.dao.ContactTableDao;
import com.example.easeimpro.model.dao.InviteTableDao;

/**
 * 联系人和邀请信息表的操作类的管理类
 */
public class DBManager {
    private final DBHelper dbHelper;
    private final ContactTableDao contactTableDao;
    private final InviteTableDao inviteTableDao;

    private static final String TAG = "DBManager";
    public DBManager(Context context,String name){
        Log.e(TAG, "DBManager: "+name );
        dbHelper = new DBHelper(context,name);//创建数据库
        //创建两张表的操作类
        contactTableDao = new ContactTableDao(dbHelper);

        inviteTableDao = new InviteTableDao(dbHelper);

    }
    //获得联系人表的操作类对象
    public ContactTableDao getContactTableDao(){
        return contactTableDao;
    }
    //获得邀请信息表的操作类对象
    public InviteTableDao getInviteTableDao(){

        return inviteTableDao;
    }

//关闭数据库
    public void close() {
        dbHelper.close();
    }
}
